<?php
    $file_name_counter = 'count_file.txt';
    if (file_exists($file_name_counter)) {
        $fil = fopen($file_name_counter, 'r');
        $dat = fread($fil, filesize($file_name_counter));
        echo $dat+1;
        fclose($fil);
        $fil = fopen($file_name_counter, 'w');
        fwrite($fil, $dat+1);
    } else {
        $fil = fopen($file_name_counter, 'w');
        fwrite($fil, 1);
        echo '1';
        fclose($fil);
    }
?>